Conversation
...-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/CppWriter.java
Show resolved
Hide resolved
0fd0691 to
661e748
Compare
| implementation("software.amazon.smithy:smithy-aws-traits:1.51.0") | ||
| implementation("software.amazon.smithy:smithy-waiters:1.51.0") | ||
| implementation("software.amazon.smithy:smithy-rules-engine:1.51.0") | ||
| implementation("software.amazon.smithy:smithy-aws-endpoints:1.51.0") |
There was a problem hiding this comment.
Why do we need this? It's not like we're going to be using smithy based endpoints rule traits right?
There was a problem hiding this comment.
Ah, this was from copying the pattern used in our codegen-workshop.
I will refactor the build script to use our existing pattern from smoke-test gen
There was a problem hiding this comment.
Smithy actually needs all the above dependencies, in the current set up we are not accepting any unknown traits
.../util/awsclientsmithygenerator/generators/pagination/PaginationCompilationTestGenerator.java
Outdated
Show resolved
Hide resolved
20097ca to
7433789
Compare
a426d02 to
03ae46d
Compare
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientPagination.h
Outdated
Show resolved
Hide resolved
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/ScanPaginationTraits.h
Outdated
Show resolved
Hide resolved
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClient.h
Show resolved
Hide resolved
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBPaginationBase.h
Outdated
Show resolved
Hide resolved
generated/tests/dynamodb-gen-tests/DynamoDBPaginationCompilationTests.cpp
Show resolved
Hide resolved
tests/aws-cpp-sdk-dynamodb-integration-tests/ScanPaginationIntegrationTest.cpp
Outdated
Show resolved
Hide resolved
...m/amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationCodegenPlugin.java
Show resolved
Hide resolved
239688c to
fe3fc77
Compare
...m/amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationCodegenPlugin.java
Outdated
Show resolved
Hide resolved
...m/amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationCodegenPlugin.java
Outdated
Show resolved
Hide resolved
...m/amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationCodegenPlugin.java
Outdated
Show resolved
Hide resolved
...m/amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationCodegenPlugin.java
Show resolved
Hide resolved
.../main/java/com/amazonaws/util/awsclientsmithygenerator/generators/ClientCodegenSettings.java
Outdated
Show resolved
Hide resolved
...-codegen/src/main/java/com/amazonaws/util/awsclientsmithygenerator/generators/ShapeUtil.java
Outdated
Show resolved
Hide resolved
...amazonaws/util/awsclientsmithygenerator/generators/pagination/PaginationTraitsGenerator.java
Outdated
Show resolved
Hide resolved
ac53a13 to
3616995
Compare
| size_t pageCount = 0; | ||
| auto paginator = dynamoClient.ScanPaginator(request); | ||
|
|
||
| for (auto pageIter = paginator.begin(); pageIter != paginator.end(); ++pageIter) { |
There was a problem hiding this comment.
nit: validate that
for (cont auto& pageIter: paginator) {
...
}
works as that is the most idomatic way people will likely use this
| } | ||
|
|
||
| String token = outToken.get(); | ||
| List<TokenResolver> resolvers = List.of( |
There was a problem hiding this comment.
make this static/immtuable list, we dont want to re-create this everytime we call the function, this list will never change at runtime
There was a problem hiding this comment.
Okay I made it immutable with final and initialized in the constructor, this way we only re-create this once per service generation and not once per trait generation
private final List<TokenResolver> resolvers; initialized in the constructor
| for (TokenResolver resolver : resolvers) { | ||
| if (resolver.canResolve(token, op)) { | ||
| resolver.writeLogic(writer, token, op); | ||
| return; |
There was a problem hiding this comment.
premature returning is anti patter lets make this a a stream
resolvers.stream()
.filter(resolver -> resolver.canResolve(token, op))
.findFirst()
.ifPresentOrElse(resolver -> resolver.writeLogic(writer, token, op),
() -> {
// Fallback
if (ShapeUtil.hasTopLevelMember(context.getModel(), op, "IsTruncated")) {
writer.write(" return result.GetIsTruncated();");
} else {
writer.write(" return false;");
}
});
potentially refactoring the fallback method to a private function
There was a problem hiding this comment.
Made it into a stream instead of early return.
Not sure if we need to refactor it to a private function though, its only used in this specific case.
|
approved, try to address the left over comments as you fix the build |
ab5b36c to
6771542
Compare
… clients, service-specific patches, and integration tests for S3, EC2, and DynamoDB
6771542 to
74555ec
Compare
Issue #, if available:
Description of changes:
Smithy-based code generator for paginators
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.